package com.bluebridgecup.javabasics;

import java.util.Scanner;
// 最大公约数查找器
public class GreatestCommonDivisorFinder {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        //在此输入您的代码...
        int a = scan.nextInt();
        int b = scan.nextInt();
        int i = 0;
        if (a > b) {
            i = a;
        } else {
            i = b;
        }
        for (; i != 1; i--) {
            if (a % i == 0 && b % i == 0) {
                break;
            }
        }
        System.out.println(i);
        scan.close();
    }
}
